/*
 * @lc app=leetcode.cn id=2154 lang=typescript
 *
 * [2154] 将找到的值乘以 2
 */

// @lc code=start
function findFinalValue(nums: number[], original: number): number {
    nums = nums.sort((a, b) => a - b);
    let temp = original;
    for (let i = 0; i < nums.length; i++) {
        const element = nums[i];
        if (element === temp) {
            temp *= 2;
        }
    }

    return temp;
}
// @lc code=end
